<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>xilflash: xilflash_cfi.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">xilflash
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;"
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xilflash__cfi_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xilflash_cfi.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>The file implements the functions for retrieval and translation of CFI data from a compliant flash device. </p>
<p>CFI contains data that defines part geometry, write/erase timing, and programming data.</p>
<p>Data is retrieved using macros defined in this xflash_cfi.h file. The macros simplify data extraction because they have been written to take into account the layout of parts on the data bus. To the library, CFI data appears as if it were always being read from a single 8-bit part (XFL_LAYOUT_X8_X8_X1) Otherwise, the retrieval code would have to contend with all the formats illustrated below. The illustration shows how the first three bytes of the CFI query data "QRY" appear in flash memory space for various part layouts. </p>
<pre></pre><pre>                Byte Offset (Big-Endian)
                0123456789ABCDEF
                ----------------
                XFL_LAYOUT_X16_X16_X1   Q R Y
                XFL_LAYOUT_X16_X16_X2   Q Q R R Y Y
</pre><p>Where the holes between Q, R, and Y are NULL (all bits 0)</p>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>This code is intended to be RTOS and processor independent. It works with physical addresses only. Any needs for dynamic memory management, threads, mutual exclusion, virtual memory, or cache control management must be satisfied by the layer above this library.</p>
<pre>
MODIFICATION HISTORY:</pre><pre>Ver   Who  Date     Changes
</p>
<hr/>
<p>
1.00a rmm  10/25/07 First release
1.00a mta  10/25/07 Updated to flash library
1.01a ksu  04/10/08 Added support for AMD CFI Interface
1.02a ksu  08/06/09 Added code to read the platform flash bank information
2.00a ktn  12/04/09 Updated to use the HAL processor APIs/macros
2.02a sdm  06/30/10 Updated to support AXI EMC with Little Endian Processor
3.00a sdm  03/03/11 Removed static parameters in mld and updated code to
              determine these parameters from the CFI data.
3.01a srt  03/02/12 Added support for Micron G18 Flash device to fix
              CRs 648372, 648282.
              Added DATA_SYNC to fix the CR 644750.
3.02a srt  05/30/12 Changed Implementation for Micron G18 Flash, which
              fixes the CR 662317.
              CR 662317 Description - Xilinx Platform Flash on ML605
              fails to work.
3.04a srt  02/18/13 Fixed CR 700553.
4.5     tjs  08/13/18 Fixed compilation errors for ARMCC (CR#1008306)
4.7     akm  07/23/19 Initialized Status variable to XST_FAILURE.
4.10    akm  07/14/23 Added support for system device-tree flow.
</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a025ba2cd783a06301dc7caa4fb537d95"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xilflash__cfi_8c.html#a025ba2cd783a06301dc7caa4fb537d95">XFlashCFI_ReadCommon</a> (XFlash *InstancePtr, u8 BusWidth)</td></tr>
<tr class="memdesc:a025ba2cd783a06301dc7caa4fb537d95"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieves the standard CFI data from the part(s), interpret the data, and update the provided geometry and properties structures.  <a href="#a025ba2cd783a06301dc7caa4fb537d95">More...</a><br/></td></tr>
<tr class="separator:a025ba2cd783a06301dc7caa4fb537d95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad868fe5f733b6042f9ee8b6adb59652c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xilflash__cfi_8c.html#ad868fe5f733b6042f9ee8b6adb59652c">XFlashCFI_Read8</a> (u8 *Ptr, u8 Interleave, u8 Mode)</td></tr>
<tr class="memdesc:ad868fe5f733b6042f9ee8b6adb59652c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads 8-bits of data from the CFI data location into a local variable.  <a href="#ad868fe5f733b6042f9ee8b6adb59652c">More...</a><br/></td></tr>
<tr class="separator:ad868fe5f733b6042f9ee8b6adb59652c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a25c9cc3b842a35592e8b009f64b3df1f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xilflash__cfi_8c.html#a25c9cc3b842a35592e8b009f64b3df1f">XFlashCFI_Read16</a> (u8 *Ptr, u8 Interleave, u8 Mode)</td></tr>
<tr class="memdesc:a25c9cc3b842a35592e8b009f64b3df1f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads 16-bits of data from the CFI data location into a local variable.  <a href="#a25c9cc3b842a35592e8b009f64b3df1f">More...</a><br/></td></tr>
<tr class="separator:a25c9cc3b842a35592e8b009f64b3df1f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a25c9cc3b842a35592e8b009f64b3df1f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XFlashCFI_Read16 </td>
          <td>(</td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>Ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>Interleave</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>Mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reads 16-bits of data from the CFI data location into a local variable. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Ptr</td><td>is the pointer to read. Can be a pointer to any type. </td></tr>
    <tr><td class="paramname">Interleave</td><td>is the byte interleaving (based on part layout). </td></tr>
    <tr><td class="paramname">Mode</td><td>is the mode of operation (based on part layout).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The 16-bit value at Ptr adjusted for the interleave factor. </dd></dl>

<p>Referenced by <a class="el" href="xilflash__cfi_8c.html#a025ba2cd783a06301dc7caa4fb537d95">XFlashCFI_ReadCommon()</a>.</p>

</div>
</div>
<a class="anchor" id="ad868fe5f733b6042f9ee8b6adb59652c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XFlashCFI_Read8 </td>
          <td>(</td>
          <td class="paramtype">u8 *&#160;</td>
          <td class="paramname"><em>Ptr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>Interleave</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>Mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reads 8-bits of data from the CFI data location into a local variable. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Ptr</td><td>is the pointer to read. Can be a pointer to any type. </td></tr>
    <tr><td class="paramname">Interleave</td><td>is the byte interleaving (based on part layout). </td></tr>
    <tr><td class="paramname">Mode</td><td>is the mode of operation (based on part layout).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The byte at Ptr adjusted for the interleave factor. </dd></dl>

<p>Referenced by <a class="el" href="xilflash__cfi_8c.html#a025ba2cd783a06301dc7caa4fb537d95">XFlashCFI_ReadCommon()</a>.</p>

</div>
</div>
<a class="anchor" id="a025ba2cd783a06301dc7caa4fb537d95"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XFlashCFI_ReadCommon </td>
          <td>(</td>
          <td class="paramtype">XFlash *&#160;</td>
          <td class="paramname"><em>InstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u8&#160;</td>
          <td class="paramname"><em>BusWidth</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Retrieves the standard CFI data from the part(s), interpret the data, and update the provided geometry and properties structures. </p>
<p>Extended CFI data is part specific and ignored here. This data must be read by the specific flash device family library.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">InstancePtr</td><td>is the pointer to the XFlash instance. </td></tr>
    <tr><td class="paramname">BusWidth</td><td>is the total width of the flash memory, in bytes.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS if successful.</li>
<li>XFLASH_CFI_QUERY_ERROR if an error occurred interpreting the data.</li>
<li>XFLASH_PART_NOT_SUPPORTED if invalid Layout parameter.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>References <a class="el" href="xilflash__cfi_8h.html#a2e6f76db4955297ab8edfd917acf4e40">XFL_CFI_ADVANCE_PTR16</a>, <a class="el" href="xilflash__cfi_8h.html#abee73d45fcdf7098f5b2daf57b27698a">XFL_CFI_ADVANCE_PTR8</a>, <a class="el" href="xilflash__cfi_8h.html#a12bd0c89aecceb6ce7e6449d0a76137a">XFL_CFI_POSITION_PTR</a>, <a class="el" href="xilflash__cfi_8h.html#a5f6c51f2f7f22d4a83dd5fb20cea6812">XFL_LAYOUT_NUM_PARTS_MASK</a>, <a class="el" href="xilflash__cfi_8h.html#a25c9cc3b842a35592e8b009f64b3df1f">XFlashCFI_Read16()</a>, and <a class="el" href="xilflash__cfi_8h.html#ad868fe5f733b6042f9ee8b6adb59652c">XFlashCFI_Read8()</a>.</p>

<p>Referenced by <a class="el" href="group__xilflash__apis.html#gab4c908ad78f6ded9407d0dc7ed611370">XFlash_Initialize()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
